const userInfo = {
  avatarUrl:
    'https://we-retail-static-1300977798.cos.ap-guangzhou.myqcloud.com/retail-ui/components-exp/avatar/avatar-1.jpg',
  nickName: 'TDesign 🌟',
  phoneNumber: '13438358888',
  gender: 2,
};
const countsData = [
  {
    num: 2,
    name: '积分',
    type: 'point',
  },
  {
    num: 10,
    name: '优惠券',
    type: 'coupon',
  },
];

const orderTagInfos = [
  {
    orderNum: 1,
    tabType: 5,
  },
  {
    orderNum: 3,
    tabType: 10,
  },
  {
    orderNum: 4,
    tabType: 40,
  },
  {
    orderNum: 1,
    tabType: 0,
  },
];

const customerServiceInfo = {
  servicePhone: '4006336868',
  serviceTimeDuration: '每周三至周五 9:00-12:00  13:00-15:00',
};

export const genSimpleUserInfo = () => ({ ...userInfo });

export const genUsercenter = () => {
  wx.cloud.callFunction({
    name: 'getUserCenter',
    success(res) {
      console.log('请求成功', res.result);
    },
    fail(err){
      console.log('请求失败', err);
    }
  })

  // wx.login({
  //   success (res) {
  //     if (res.code) {
  //       console.log('登录成功',res.code)
  //       //发起网络请求
  //       // wx.request({
  //       //   url: 'https://api.weixin.qq.com/sns/jscode2session',
  //       //   data: {
  //       //     appid:'wx20e9aa5ea6eea026',
  //       //     secret: '1cc47b5c4f9a2c950a28cc2a7df3c7e8',
  //       //     js_code: res.code,
  //       //     grant_type:'authorization_code'
  //       //   },
  //       //   success(res) {
  //       //     console.log('请求成功', JSON.stringify(res));
  //       //   },
  //       // })
  //     } else {
  //       console.log('登录失败！' + res.errMsg)
  //     }
  //   }
  // })

  return {
    userInfo,
    countsData,
    orderTagInfos,
    customerServiceInfo,
  }
};
